Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node:child_process: support defining extra pipes #7958

Merged
merged 21 commits into from
Jan 5, 2024
Merged

Conversation

nektro
Copy link
Member

@nektro nektro commented Jan 3, 2024

adds support in require("node:child_process").spawn for specifying extra file descriptors that are pipes to be sent to the child process. also fixes other small discrepancies we had with the node api in this area.

Copy link
Contributor

github-actions bot commented Jan 3, 2024

@nektro 3 files with test failures on bun-darwin-aarch64:

  • test/cli/install/registry/bun-install-registry.test.ts
  • test/cli/test/bun-test.test.ts
  • test/js/third_party/webpack/webpack.test.ts

View test output

#f6d3e1b8fa4773a3be3673c195151c1cee043563

src/js/node/stream.js Outdated Show resolved Hide resolved
Copy link
Contributor

github-actions bot commented Jan 3, 2024

@nektro 4 files with test failures on bun-darwin-x64-baseline:

  • test/cli/test/bun-test.test.ts
  • test/js/bun/util/which.test.ts
  • test/js/node/fs/fs.test.ts
  • test/js/third_party/webpack/webpack.test.ts

View test output

#f6d3e1b8fa4773a3be3673c195151c1cee043563

Copy link
Contributor

github-actions bot commented Jan 3, 2024

@nektro 5 files with test failures on bun-darwin-x64:

  • test/cli/test/bun-test.test.ts
  • test/js/bun/util/which.test.ts
  • test/js/node/fs/fs.test.ts
  • test/js/node/watch/fs.watchFile.test.ts
  • test/js/third_party/webpack/webpack.test.ts

View test output

#f6d3e1b8fa4773a3be3673c195151c1cee043563

Copy link
Contributor

github-actions bot commented Jan 5, 2024

@nektro 3 files with test failures on linux-x64:

  • test/cli/test/bun-test.test.ts
  • test/integration/next/default-pages-dir/test/next-build.test.ts
  • test/js/third_party/webpack/webpack.test.ts

View test output

#f6d3e1b8fa4773a3be3673c195151c1cee043563

Copy link
Contributor

github-actions bot commented Jan 5, 2024

@nektro 3 files with test failures on linux-x64-baseline:

  • test/cli/test/bun-test.test.ts
  • test/integration/next/default-pages-dir/test/next-build.test.ts
  • test/js/third_party/webpack/webpack.test.ts

View test output

#f6d3e1b8fa4773a3be3673c195151c1cee043563

Jarred-Sumner added a commit to Jarred-Sumner/playwright that referenced this pull request Jan 5, 2024
This adds a `package.json` `"exports"` condition for Bun which always chooses the CommonJS version of the export (for both ESM & CJS).

This package uses `__esModule` to tell bundlers that it was ESM converted into CommonJS. Bun supports this both at runtime and when using the bundler, but Node.js does not support this at runtime and that causes a compatibility issue when importing `@playwright/test` (which is our fault). It's unfortunately a compatibility issue whether or not we support `__esModule`, because choosing to not support it breaks libraries which presently only work when using a bundler.

Since Bun automatically converts CommonJS <> ESM and `module.exports` with dynamic properties are supported, we can choose to always use the CommonJS entry point for Playwright in Bun.

There were other changes necessary to get Playwright to work, which are mostly in oven-sh/bun#7958
 

Signed-off-by: Jarred Sumner <[email protected]>
@Jarred-Sumner Jarred-Sumner merged commit fa7e4bc into main Jan 5, 2024
18 of 20 checks passed
@Jarred-Sumner Jarred-Sumner deleted the nektro-patch-9 branch January 5, 2024 08:38
ryoppippi pushed a commit to ryoppippi/bun that referenced this pull request Feb 1, 2024
* node:child_process: support defining extra pipes

* unneeded

* lazily load node:fs

* use $isJSArray instead of ArrayIsArray

* remove std.log call

* don't close child fd we don't own

* close child fd's in parent

* add Subprocess.stdio getter that aligns with ChildProcess.stdio fd's

* [autofix.ci] apply automated fixes

* use ArrayList instead of BoundedArray for stdio_pipes

* fix stream primordials

* dont use unreachable for syscalls

* this file was testing Bun.spawn not child_process.spawn

* skip ipc for now

* ensure the socketpair is created non-blocking on non-mac posix

* allow creating a node:net.Socket from an fd via node:net.connect

* node:stream tidy

* node:child_process: use net.Socket for stdio instead of fs streams

* try again

* fix Socket eager loading

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarred Sumner <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants